package com.gioneco;

import com.gioneco.model.ShareDetailInfo;
import com.gioneco.util.EsLambdaQueryUtil;
import com.gioneco.util.esCondition.Criteria;
import com.gioneco.util.esCondition.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Map;

@SpringBootApplication
public class Application implements CommandLineRunner {

    @Autowired
    EsLambdaQueryUtil esLambdaQueryUtil;

    public static void main(String[] args) {
        SpringApplication.run(Application.class);
    }

    @Override
    public void run(String... args) throws Exception {
        Map<String, Long> stringLongMap = esLambdaQueryUtil.selectQueryGroupByOneField(Query.<ShareDetailInfo>query(
                Criteria.where(ShareDetailInfo::getDataType).is(2)
                        .groupByDate(ShareDetailInfo::getSystemTime)
        ), ShareDetailInfo.class);
        System.out.println(stringLongMap);
    }
}
